function Get-ExistingResources {
    [CmdletBinding()]
    param ([Parameter(Mandatory = $true)][string]$ResourceGroup)

    # Get existing resources in Azure.
    $ExistingResources = Get-AzResource -ResourceGroupName $ResourceGroup

    # Extract different types of existing resources.
    return @{
        Servers = $ExistingResources | Where-Object { $_.ResourceType -eq 'Microsoft.Sql/servers' }
        Databases = $ExistingResources | Where-Object { $_.ResourceType -eq 'Microsoft.Sql/servers/databases' }
        ADFv2s = $ExistingResources | Where-Object { $_.ResourceType -eq 'Microsoft.DataFactory/factories' }
    }
}